package com.xiaoyi.intentsdklibrary.Bean;

import android.database.Cursor;
import android.database.sqlite.SQLiteStatement;
import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.Property;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.database.DatabaseStatement;
import org.greenrobot.greendao.internal.DaoConfig;

public class AppBeanDao extends AbstractDao<AppBean, Long> {
    public static final String TABLENAME = "APP_BEAN";

    public static class Properties {
        public static final Property AppName = new Property(1, String.class, "appName", false, "APP_NAME");
        public static final Property Id = new Property(0, Long.class, "id", true, "_id");
        public static final Property PackageName = new Property(2, String.class, "packageName", false, "PACKAGE_NAME");
        public static final Property VersionCode = new Property(4, Integer.TYPE, "versionCode", false, "VERSION_CODE");
        public static final Property VersionName = new Property(3, String.class, "versionName", false, "VERSION_NAME");
    }

    /* access modifiers changed from: protected */
    @Override // org.greenrobot.greendao.AbstractDao
    public final boolean isEntityUpdateable() {
        return true;
    }

    public AppBeanDao(DaoConfig daoConfig) {
        super(daoConfig);
    }

    public AppBeanDao(DaoConfig daoConfig, DaoSession daoSession) {
        super(daoConfig, daoSession);
    }

    public static void createTable(Database database, boolean z) {
        String str = z ? "IF NOT EXISTS " : "";
        database.execSQL("CREATE TABLE " + str + "\"APP_BEAN\" (\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ,\"APP_NAME\" TEXT,\"PACKAGE_NAME\" TEXT UNIQUE ,\"VERSION_NAME\" TEXT,\"VERSION_CODE\" INTEGER NOT NULL );");
    }

    public static void dropTable(Database database, boolean z) {
        StringBuilder sb = new StringBuilder();
        sb.append("DROP TABLE ");
        sb.append(z ? "IF EXISTS " : "");
        sb.append("\"APP_BEAN\"");
        database.execSQL(sb.toString());
    }

    /* access modifiers changed from: protected */
    public final void bindValues(DatabaseStatement databaseStatement, AppBean appBean) {
        databaseStatement.clearBindings();
        Long id = appBean.getId();
        if (id != null) {
            databaseStatement.bindLong(1, id.longValue());
        }
        String appName = appBean.getAppName();
        if (appName != null) {
            databaseStatement.bindString(2, appName);
        }
        String packageName = appBean.getPackageName();
        if (packageName != null) {
            databaseStatement.bindString(3, packageName);
        }
        String versionName = appBean.getVersionName();
        if (versionName != null) {
            databaseStatement.bindString(4, versionName);
        }
        databaseStatement.bindLong(5, (long) appBean.getVersionCode());
    }

    /* access modifiers changed from: protected */
    public final void bindValues(SQLiteStatement sQLiteStatement, AppBean appBean) {
        sQLiteStatement.clearBindings();
        Long id = appBean.getId();
        if (id != null) {
            sQLiteStatement.bindLong(1, id.longValue());
        }
        String appName = appBean.getAppName();
        if (appName != null) {
            sQLiteStatement.bindString(2, appName);
        }
        String packageName = appBean.getPackageName();
        if (packageName != null) {
            sQLiteStatement.bindString(3, packageName);
        }
        String versionName = appBean.getVersionName();
        if (versionName != null) {
            sQLiteStatement.bindString(4, versionName);
        }
        sQLiteStatement.bindLong(5, (long) appBean.getVersionCode());
    }

    @Override // org.greenrobot.greendao.AbstractDao
    public Long readKey(Cursor cursor, int i) {
        int i2 = i + 0;
        if (cursor.isNull(i2)) {
            return null;
        }
        return Long.valueOf(cursor.getLong(i2));
    }

    @Override // org.greenrobot.greendao.AbstractDao
    public AppBean readEntity(Cursor cursor, int i) {
        int i2 = i + 0;
        Long valueOf = cursor.isNull(i2) ? null : Long.valueOf(cursor.getLong(i2));
        int i3 = i + 1;
        String string = cursor.isNull(i3) ? null : cursor.getString(i3);
        int i4 = i + 2;
        String string2 = cursor.isNull(i4) ? null : cursor.getString(i4);
        int i5 = i + 3;
        return new AppBean(valueOf, string, string2, cursor.isNull(i5) ? null : cursor.getString(i5), cursor.getInt(i + 4));
    }

    public void readEntity(Cursor cursor, AppBean appBean, int i) {
        int i2 = i + 0;
        String str = null;
        appBean.setId(cursor.isNull(i2) ? null : Long.valueOf(cursor.getLong(i2)));
        int i3 = i + 1;
        appBean.setAppName(cursor.isNull(i3) ? null : cursor.getString(i3));
        int i4 = i + 2;
        appBean.setPackageName(cursor.isNull(i4) ? null : cursor.getString(i4));
        int i5 = i + 3;
        if (!cursor.isNull(i5)) {
            str = cursor.getString(i5);
        }
        appBean.setVersionName(str);
        appBean.setVersionCode(cursor.getInt(i + 4));
    }

    /* access modifiers changed from: protected */
    public final Long updateKeyAfterInsert(AppBean appBean, long j) {
        appBean.setId(Long.valueOf(j));
        return Long.valueOf(j);
    }

    public Long getKey(AppBean appBean) {
        if (appBean != null) {
            return appBean.getId();
        }
        return null;
    }

    public boolean hasKey(AppBean appBean) {
        return appBean.getId() != null;
    }
}
